<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <th:block th:insert="~{/common/include_easyui :: include_easyui}"></th:block>
        <script type="text/javascript" th:inline="javascript">

            var ctxPath = /*[[${#httpServletRequest.getContextPath()}]]*/ "/as";

            function saveData() {

                var isValid = jQuery("#modifyForm").form('validate');
                if (!isValid) {
                    jQuery("#modifyForm").form('enableValidation');
                } else {

                    var saveURL = ctxPath + "/menuMgrController/modifyMenu?date=" + new Date() + "";
                    var paramObj = jQuery("#modifyForm").serializeArray();

                    jQuery.post(saveURL, paramObj, function (responseData) {

                        var code = responseData.code;

                        if (code == "200") {
                            $.messager.alert('我的消息', '菜单信息修改成功！', 'info', function () {
                                var parentWin = window.parent;
                                parentWin.jQuery("#div_table").treegrid("reload");
                                parentWin.jQuery('#dialog_div').dialog("close");
                            });

                        } else {
                            $.messager.alert('我的消息', "数据保存出错，原因 ：" + responseData.message, 'error');
                        }

                    }, "json");
                }


            }

            $(function () {
                var value = /*[[${menu.menuTarget}]]*/ '';
                $('#menuTarget').combobox('setValue', value);
                //alert($('#menuTarget').val())
            });

        </script>

        <style type="text/css">


            .modify-form div {
                margin-bottom: 20px;
                /* 	display: flex;
                    justify-content:center; */
            }

            .modify-form div input {
                max-width: 400px;
                height: 28px;
                width: 100%;
            }
        </style>
    </head>

    <body>

        <form id="modifyForm" method="post" class="modify-form">
            <input type="hidden" th:value="${menu.parentId}" name="parentId">
            <div style="padding-left:12%;margin-top:30px;width: 80%;">
                <input class="easyui-textbox" name="menuId" th:value="${parentMenuName}" labelAlign="right"
                       data-options="label:'父菜单：',disabled:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="menuId" th:value="${menu.menuId}" labelAlign="right"
                       data-options="label:'菜单ID：',required:true,readonly:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="grade" th:value="${menu.grade}" labelAlign="right"
                       data-options="label:'菜单等级：',readonly:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="menuName" th:value="${menu.menuName}" labelAlign="right"
                       data-options="label:'菜单名称：',required:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="menuHref" th:value="${menu.menuHref}" labelAlign="right"
                       data-options="label:'菜单链接：'">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <select class="easyui-combobox" name="menuTarget" style="width: 80%;" id="menuTarget"
                        labelAlign="right" data-options="label:'菜单位置：',editable:false">
                    <option value="">==请选择==</option>
                    <option value="rightFrame">右边菜单栏</option>
                    <option value="leftFrame">左边菜单栏</option>
                    <option value="topFrame">顶部菜单栏</option>
                    <option value="bottomFrame">底部菜单栏</option>
                </select>
            </div>
        </form>

    </body>
</html>
